<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象练习</title>
</head>

<body>
    <script>
        // 那撸多
        var naluduo = new Object()
        naluduo.name = '鸣人'
        naluduo.sex = '男'
        naluduo.age = 18
        naluduo.skill = function () {
            console.log(naluduo.name + '技能:影分身之术');
        }
        console.log(naluduo);
        naluduo.skill();

        // 大白
        function Person(name, age, sex) {
            this.name = name;
            this.age = age;
            this.sex = sex;
            this.sayHi = function () {
                alert('我的名字叫：' + this.name + '，年龄：' + this.age + '，性别：' + this.sex);
            }
        }
        var bigbai = new Person('大白', 100, '男');
        var smallbai = new Person('小白', 21, '男');
        console.log(bigbai.name);
        bigbai.sayHi()
        console.log(smallbai.name);
        smallbai.sayHi()
    </script>
</body>

</html>